﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;

namespace WebTest
{
    /// <summary>
    /// Just some random testing...
    /// </summary>
    class Program
    {
        static void Main(string[] args)
        {
            HttpWebRequest request = WebRequest.Create(@"http://www.audioverse.org/downloadmedia/21/rss/2003/9/21/20030308-1100-Peter_Gregory-Home_at_Last.mp3") as HttpWebRequest;

            if (request != null)
            {
                try
                {

                    HttpWebResponse response = request.GetResponse() as HttpWebResponse;
                    Console.WriteLine(response.Headers);
                    response.Close();
                }
                catch (WebException e)
                {
                    Console.WriteLine(e.Message);
                }
            }

            try
            {
                using (FileStream f = new FileStream(@"E:\Temp\test.dat", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite, 8 * 1024, FileOptions.RandomAccess))
                {
                    f.Seek(1024*1024, SeekOrigin.Begin);
                    f.WriteByte(0);
                    f.Close();
                }

                FileStream s = null;

                object o = s as object;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}
